<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<body>
<div class="pull-left">
    <div class="form-group form-inline">
        总共${pageInfo.pages} 页，共${pageInfo.total} 条数据。
        每页显示
        <select id="selectPageSize" name="selectPageSize" onchange="goPage(1)">
            <c:forEach var="num" begin="1" end="10" step="1">
                <option value="${num}" ${pageInfo.pageSize == num?'selected':''}>${num}</option>
            </c:forEach>
        </select>
    </div>
</div>

<div class="box-tools pull-right">
    <ul class="pagination" style="margin: 0px;">
        <li >
            <a href="javascript:goPage(1)" aria-label="Previous">首页</a>
        </li>
        <li><a href="javascript:goPage(${pageInfo.prePage})">上一页</a></li>

        <c:forEach
                begin="${pageInfo.navigateFirstPage}"
                end="${pageInfo.navigateLastPage}" var="i">
            <li class="paginate_button ${i == pageInfo.pageNum ? 'active' : ''}">
                <a href="javascript:goPage(${i})">${i}</a>
            </li>
        </c:forEach>

        <li><a href="javascript:goPage(${pageInfo.nextPage})">下一页</a></li>
        <li>
            <a href="javascript:goPage(${pageInfo.pages})" aria-label="Next">尾页</a>
        </li>
    </ul>
</div>
<%--${param.pageUrl} 获取的是分页提交地址，比如：/system/dept/list.do--%>
<form id="pageForm" action="${param.pageUrl}" method="post">
    <input type="hidden" name="pageNum" id="pageNum">
    <input type="hidden" name="pageSize" id="pageSize">
</form>
<script>
    // 参数：当前页
    function goPage(pageNum) {
        // 获取页大小
        var selectPageSize =  $("#selectPageSize").val();
        // 设置到表单隐藏域
        $("#pageSize").val(selectPageSize);
        $("#pageNum").val(pageNum);
        $("#pageForm").submit();
    }
</script>
</body>
</html>
